<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>defaulttoolbar.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_ui_editor_defaulttoolbar.js.html">defaulttoolbar.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2008 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview Factory functions for creating a default editing toolbar.
<a name="line17"></a> *
<a name="line18"></a> * @author attila@google.com (Attila Bodis)
<a name="line19"></a> * @author jparent@google.com (Julie Parent)
<a name="line20"></a> * @see ../../demos/editor/editor.html
<a name="line21"></a> */
<a name="line22"></a>
<a name="line23"></a>goog.provide(&#39;goog.ui.editor.DefaultToolbar&#39;);
<a name="line24"></a>
<a name="line25"></a>goog.require(&#39;goog.dom&#39;);
<a name="line26"></a>goog.require(&#39;goog.dom.TagName&#39;);
<a name="line27"></a>goog.require(&#39;goog.dom.classes&#39;);
<a name="line28"></a>goog.require(&#39;goog.editor.Command&#39;);
<a name="line29"></a>goog.require(&#39;goog.style&#39;);
<a name="line30"></a>goog.require(&#39;goog.ui.ControlContent&#39;);
<a name="line31"></a>goog.require(&#39;goog.ui.editor.ToolbarFactory&#39;);
<a name="line32"></a>goog.require(&#39;goog.ui.editor.messages&#39;);
<a name="line33"></a>
<a name="line34"></a>// Font menu creation.
<a name="line35"></a>
<a name="line36"></a>
<a name="line37"></a>/** @desc Font menu item caption for the default sans-serif font. */
<a name="line38"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_NORMAL = goog.getMsg(&#39;Normal&#39;);
<a name="line39"></a>
<a name="line40"></a>
<a name="line41"></a>/** @desc Font menu item caption for the default serif font. */
<a name="line42"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_NORMAL_SERIF =
<a name="line43"></a>    goog.getMsg(&#39;Normal / serif&#39;);
<a name="line44"></a>
<a name="line45"></a>
<a name="line46"></a>/**
<a name="line47"></a> * Common font descriptors for all locales.  Each descriptor has the following
<a name="line48"></a> * attributes:
<a name="line49"></a> * &lt;ul&gt;
<a name="line50"></a> *   &lt;li&gt;{@code caption} - Caption to show in the font menu (e.g. &#39;Tahoma&#39;)
<a name="line51"></a> *   &lt;li&gt;{@code value} - Value for the corresponding &#39;font-family&#39; CSS style
<a name="line52"></a> *       (e.g. &#39;Tahoma, Arial, sans-serif&#39;)
<a name="line53"></a> * &lt;/ul&gt;
<a name="line54"></a> * @type {!Array.&lt;{caption:string, value:string}&gt;}
<a name="line55"></a> * @private
<a name="line56"></a> */
<a name="line57"></a>goog.ui.editor.DefaultToolbar.FONTS_ = [
<a name="line58"></a>  {
<a name="line59"></a>    caption: goog.ui.editor.DefaultToolbar.MSG_FONT_NORMAL,
<a name="line60"></a>    value: &#39;arial,sans-serif&#39;
<a name="line61"></a>  },
<a name="line62"></a>  {
<a name="line63"></a>    caption: goog.ui.editor.DefaultToolbar.MSG_FONT_NORMAL_SERIF,
<a name="line64"></a>    value: &#39;times new roman,serif&#39;
<a name="line65"></a>  },
<a name="line66"></a>  {caption: &#39;Courier New&#39;, value: &#39;courier new,monospace&#39;},
<a name="line67"></a>  {caption: &#39;Georgia&#39;, value: &#39;georgia,serif&#39;},
<a name="line68"></a>  {caption: &#39;Trebuchet&#39;, value: &#39;trebuchet ms,sans-serif&#39;},
<a name="line69"></a>  {caption: &#39;Verdana&#39;, value: &#39;verdana,sans-serif&#39;}
<a name="line70"></a>];
<a name="line71"></a>
<a name="line72"></a>
<a name="line73"></a>/**
<a name="line74"></a> * Locale-specific font descriptors.  The object is a map of locale strings to
<a name="line75"></a> * arrays of font descriptors.
<a name="line76"></a> * @type {!Object.&lt;!Array.&lt;{caption:string, value:string}&gt;&gt;}
<a name="line77"></a> * @private
<a name="line78"></a> */
<a name="line79"></a>goog.ui.editor.DefaultToolbar.I18N_FONTS_ = {
<a name="line80"></a>  &#39;ja&#39;: [{
<a name="line81"></a>    caption: &#39;\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af&#39;,
<a name="line82"></a>    value: &#39;ms pgothic,sans-serif&#39;
<a name="line83"></a>  }, {
<a name="line84"></a>    caption: &#39;\uff2d\uff33 \uff30\u660e\u671d&#39;,
<a name="line85"></a>    value: &#39;ms pmincho,serif&#39;
<a name="line86"></a>  }, {
<a name="line87"></a>    caption: &#39;\uff2d\uff33 \u30b4\u30b7\u30c3\u30af&#39;,
<a name="line88"></a>    value: &#39;ms gothic,monospace&#39;
<a name="line89"></a>  }],
<a name="line90"></a>  &#39;ko&#39;: [{
<a name="line91"></a>    caption: &#39;\uad74\ub9bc&#39;,
<a name="line92"></a>    value: &#39;gulim,sans-serif&#39;
<a name="line93"></a>  }, {
<a name="line94"></a>    caption: &#39;\ubc14\ud0d5&#39;,
<a name="line95"></a>    value: &#39;batang,serif&#39;
<a name="line96"></a>  }, {
<a name="line97"></a>    caption: &#39;\uad74\ub9bc\uccb4&#39;,
<a name="line98"></a>    value: &#39;gulimche,monospace&#39;
<a name="line99"></a>  }],
<a name="line100"></a>  &#39;zh-tw&#39;: [{
<a name="line101"></a>    caption: &#39;\u65b0\u7d30\u660e\u9ad4&#39;,
<a name="line102"></a>    value: &#39;pmingliu,serif&#39;
<a name="line103"></a>  }, {
<a name="line104"></a>    caption: &#39;\u7d30\u660e\u9ad4&#39;,
<a name="line105"></a>    value: &#39;mingliu,serif&#39;
<a name="line106"></a>  }],
<a name="line107"></a>  &#39;zh-cn&#39;: [{
<a name="line108"></a>    caption: &#39;\u5b8b\u4f53&#39;,
<a name="line109"></a>    value: &#39;simsun,serif&#39;
<a name="line110"></a>  }, {
<a name="line111"></a>    caption: &#39;\u9ed1\u4f53&#39;,
<a name="line112"></a>    value: &#39;simhei,sans-serif&#39;
<a name="line113"></a>  }, {
<a name="line114"></a>    caption: &#39;MS Song&#39;,
<a name="line115"></a>    value: &#39;ms song,monospace&#39;
<a name="line116"></a>  }]
<a name="line117"></a>};
<a name="line118"></a>
<a name="line119"></a>
<a name="line120"></a>/**
<a name="line121"></a> * Default locale for font names.
<a name="line122"></a> * @type {string}
<a name="line123"></a> * @private
<a name="line124"></a> */
<a name="line125"></a>goog.ui.editor.DefaultToolbar.locale_ = &#39;en-us&#39;;
<a name="line126"></a>
<a name="line127"></a>
<a name="line128"></a>/**
<a name="line129"></a> * Sets the locale for the font names.  If not set, defaults to &#39;en-us&#39;.
<a name="line130"></a> * Used only for default creation of font names name.  Must be set
<a name="line131"></a> * before font name menu is created.
<a name="line132"></a> * @param {string} locale Locale to use for the toolbar font names.
<a name="line133"></a> */
<a name="line134"></a>goog.ui.editor.DefaultToolbar.setLocale = function(locale) {
<a name="line135"></a>  goog.ui.editor.DefaultToolbar.locale_ = locale;
<a name="line136"></a>};
<a name="line137"></a>
<a name="line138"></a>
<a name="line139"></a>/**
<a name="line140"></a> * Initializes the given font menu button by adding default fonts to the menu.
<a name="line141"></a> * If goog.ui.editor.DefaultToolbar.setLocale was called to specify a locale
<a name="line142"></a> * for which locale-specific default fonts exist, those are added before
<a name="line143"></a> * common fonts.
<a name="line144"></a> * @param {!goog.ui.Select} button Font menu button.
<a name="line145"></a> */
<a name="line146"></a>goog.ui.editor.DefaultToolbar.addDefaultFonts = function(button) {
<a name="line147"></a>  // Normalize locale to lowercase, with a hyphen (see bug 1036165).
<a name="line148"></a>  var locale =
<a name="line149"></a>      goog.ui.editor.DefaultToolbar.locale_.replace(/_/, &#39;-&#39;).toLowerCase();
<a name="line150"></a>  // Add locale-specific default fonts, if any.
<a name="line151"></a>  var fontlist = [];
<a name="line152"></a>
<a name="line153"></a>  if (locale in goog.ui.editor.DefaultToolbar.I18N_FONTS_) {
<a name="line154"></a>     fontlist = goog.ui.editor.DefaultToolbar.I18N_FONTS_[locale];
<a name="line155"></a>  }
<a name="line156"></a>  if (fontlist.length) {
<a name="line157"></a>    goog.ui.editor.ToolbarFactory.addFonts(button, fontlist);
<a name="line158"></a>  }
<a name="line159"></a>  // Add locale-independent default fonts.
<a name="line160"></a>  goog.ui.editor.ToolbarFactory.addFonts(button,
<a name="line161"></a>      goog.ui.editor.DefaultToolbar.FONTS_);
<a name="line162"></a>};
<a name="line163"></a>
<a name="line164"></a>
<a name="line165"></a>// Font size menu creation.
<a name="line166"></a>
<a name="line167"></a>
<a name="line168"></a>/** @desc Font size menu item caption for the &#39;Small&#39; size. */
<a name="line169"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_SMALL = goog.getMsg(&#39;Small&#39;);
<a name="line170"></a>
<a name="line171"></a>
<a name="line172"></a>/** @desc Font size menu item caption for the &#39;Normal&#39; size. */
<a name="line173"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_NORMAL = goog.getMsg(&#39;Normal&#39;);
<a name="line174"></a>
<a name="line175"></a>
<a name="line176"></a>/** @desc Font size menu item caption for the &#39;Large&#39; size. */
<a name="line177"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_LARGE = goog.getMsg(&#39;Large&#39;);
<a name="line178"></a>
<a name="line179"></a>
<a name="line180"></a>/** @desc Font size menu item caption for the &#39;Huge&#39; size. */
<a name="line181"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_HUGE = goog.getMsg(&#39;Huge&#39;);
<a name="line182"></a>
<a name="line183"></a>
<a name="line184"></a>/**
<a name="line185"></a> * Font size descriptors, each with the following attributes:
<a name="line186"></a> * &lt;ul&gt;
<a name="line187"></a> *   &lt;li&gt;{@code caption} - Caption to show in the font size menu (e.g. &#39;Huge&#39;)
<a name="line188"></a> *   &lt;li&gt;{@code value} - Value for the corresponding HTML font size (e.g. 6)
<a name="line189"></a> * &lt;/ul&gt;
<a name="line190"></a> * @type {!Array.&lt;{caption:string, value:number}&gt;}
<a name="line191"></a> * @private
<a name="line192"></a> */
<a name="line193"></a>goog.ui.editor.DefaultToolbar.FONT_SIZES_ = [
<a name="line194"></a>  {caption: goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_SMALL, value: 1},
<a name="line195"></a>  {caption: goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_NORMAL, value: 2},
<a name="line196"></a>  {caption: goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_LARGE, value: 4},
<a name="line197"></a>  {caption: goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_HUGE, value: 6}
<a name="line198"></a>];
<a name="line199"></a>
<a name="line200"></a>
<a name="line201"></a>/**
<a name="line202"></a> * Initializes the given font size menu button by adding default font sizes to
<a name="line203"></a> * it.
<a name="line204"></a> * @param {!goog.ui.Select} button Font size menu button.
<a name="line205"></a> */
<a name="line206"></a>goog.ui.editor.DefaultToolbar.addDefaultFontSizes = function(button) {
<a name="line207"></a>  goog.ui.editor.ToolbarFactory.addFontSizes(button,
<a name="line208"></a>      goog.ui.editor.DefaultToolbar.FONT_SIZES_);
<a name="line209"></a>};
<a name="line210"></a>
<a name="line211"></a>
<a name="line212"></a>// Header format menu creation.
<a name="line213"></a>
<a name="line214"></a>
<a name="line215"></a>/** @desc Caption for &quot;Heading&quot; block format option. */
<a name="line216"></a>goog.ui.editor.DefaultToolbar.MSG_FORMAT_HEADING = goog.getMsg(&#39;Heading&#39;);
<a name="line217"></a>
<a name="line218"></a>
<a name="line219"></a>/** @desc Caption for &quot;Subheading&quot; block format option. */
<a name="line220"></a>goog.ui.editor.DefaultToolbar.MSG_FORMAT_SUBHEADING = goog.getMsg(&#39;Subheading&#39;);
<a name="line221"></a>
<a name="line222"></a>
<a name="line223"></a>/** @desc Caption for &quot;Minor heading&quot; block format option. */
<a name="line224"></a>goog.ui.editor.DefaultToolbar.MSG_FORMAT_MINOR_HEADING =
<a name="line225"></a>    goog.getMsg(&#39;Minor heading&#39;);
<a name="line226"></a>
<a name="line227"></a>
<a name="line228"></a>/** @desc Caption for &quot;Normal&quot; block format option. */
<a name="line229"></a>goog.ui.editor.DefaultToolbar.MSG_FORMAT_NORMAL = goog.getMsg(&#39;Normal&#39;);
<a name="line230"></a>
<a name="line231"></a>
<a name="line232"></a>/**
<a name="line233"></a> * Format option descriptors, each with the following attributes:
<a name="line234"></a> * &lt;ul&gt;
<a name="line235"></a> *   &lt;li&gt;{@code caption} - Caption to show in the menu (e.g. &#39;Minor heading&#39;)
<a name="line236"></a> *   &lt;li&gt;{@code command} - Corresponding {@link goog.dom.TagName} (e.g.
<a name="line237"></a> *       &#39;H4&#39;)
<a name="line238"></a> * &lt;/ul&gt;
<a name="line239"></a> * @type {!Array.&lt;{caption: string, command: !goog.dom.TagName}&gt;}
<a name="line240"></a> * @private
<a name="line241"></a> */
<a name="line242"></a>goog.ui.editor.DefaultToolbar.FORMAT_OPTIONS_ = [
<a name="line243"></a>  {
<a name="line244"></a>    caption: goog.ui.editor.DefaultToolbar.MSG_FORMAT_HEADING,
<a name="line245"></a>    command: goog.dom.TagName.H2
<a name="line246"></a>  },
<a name="line247"></a>  {
<a name="line248"></a>    caption: goog.ui.editor.DefaultToolbar.MSG_FORMAT_SUBHEADING,
<a name="line249"></a>    command: goog.dom.TagName.H3
<a name="line250"></a>  },
<a name="line251"></a>  {
<a name="line252"></a>    caption: goog.ui.editor.DefaultToolbar.MSG_FORMAT_MINOR_HEADING,
<a name="line253"></a>    command: goog.dom.TagName.H4
<a name="line254"></a>  },
<a name="line255"></a>  {
<a name="line256"></a>    caption: goog.ui.editor.DefaultToolbar.MSG_FORMAT_NORMAL,
<a name="line257"></a>    command: goog.dom.TagName.P
<a name="line258"></a>  }
<a name="line259"></a>];
<a name="line260"></a>
<a name="line261"></a>
<a name="line262"></a>/**
<a name="line263"></a> * Initializes the given &quot;Format block&quot; menu button by adding default format
<a name="line264"></a> * options to the menu.
<a name="line265"></a> * @param {!goog.ui.Select} button &quot;Format block&quot; menu button.
<a name="line266"></a> */
<a name="line267"></a>goog.ui.editor.DefaultToolbar.addDefaultFormatOptions = function(button) {
<a name="line268"></a>  goog.ui.editor.ToolbarFactory.addFormatOptions(button,
<a name="line269"></a>      goog.ui.editor.DefaultToolbar.FORMAT_OPTIONS_);
<a name="line270"></a>};
<a name="line271"></a>
<a name="line272"></a>
<a name="line273"></a>/**
<a name="line274"></a> * Creates a {@link goog.ui.Toolbar} containing a default set of editor
<a name="line275"></a> * toolbar buttons, and renders it into the given parent element.
<a name="line276"></a> * @param {!Element} elem Toolbar parent element.
<a name="line277"></a> * @param {boolean=} opt_isRightToLeft Whether the editor chrome is
<a name="line278"></a> *     right-to-left; defaults to the directionality of the toolbar parent
<a name="line279"></a> *     element.
<a name="line280"></a> * @return {!goog.ui.Toolbar} Default editor toolbar, rendered into the given
<a name="line281"></a> *     parent element.
<a name="line282"></a> * @see goog.ui.editor.DefaultToolbar.DEFAULT_BUTTONS
<a name="line283"></a> */
<a name="line284"></a>goog.ui.editor.DefaultToolbar.makeDefaultToolbar = function(elem,
<a name="line285"></a>    opt_isRightToLeft) {
<a name="line286"></a>  var isRightToLeft = opt_isRightToLeft || goog.style.isRightToLeft(elem);
<a name="line287"></a>  var buttons = isRightToLeft ?
<a name="line288"></a>      goog.ui.editor.DefaultToolbar.DEFAULT_BUTTONS_RTL :
<a name="line289"></a>      goog.ui.editor.DefaultToolbar.DEFAULT_BUTTONS;
<a name="line290"></a>  return goog.ui.editor.DefaultToolbar.makeToolbar(buttons, elem,
<a name="line291"></a>      opt_isRightToLeft);
<a name="line292"></a>};
<a name="line293"></a>
<a name="line294"></a>
<a name="line295"></a>/**
<a name="line296"></a> * Creates a {@link goog.ui.Toolbar} containing the specified set of
<a name="line297"></a> * toolbar buttons, and renders it into the given parent element.  Each
<a name="line298"></a> * item in the {@code items} array must either be a
<a name="line299"></a> * {@link goog.editor.Command} (to create a built-in button) or a subclass
<a name="line300"></a> * of {@link goog.ui.Control} (to create a custom control).
<a name="line301"></a> * @param {!Array.&lt;string|goog.ui.Control&gt;} items Toolbar items; each must
<a name="line302"></a> *     be a {@link goog.editor.Command} or a {@link goog.ui.Control}.
<a name="line303"></a> * @param {!Element} elem Toolbar parent element.
<a name="line304"></a> * @param {boolean=} opt_isRightToLeft Whether the editor chrome is
<a name="line305"></a> *     right-to-left; defaults to the directionality of the toolbar parent
<a name="line306"></a> *     element.
<a name="line307"></a> * @return {!goog.ui.Toolbar} Editor toolbar, rendered into the given parent
<a name="line308"></a> *     element.
<a name="line309"></a> */
<a name="line310"></a>goog.ui.editor.DefaultToolbar.makeToolbar = function(items, elem,
<a name="line311"></a>    opt_isRightToLeft) {
<a name="line312"></a>  var domHelper = goog.dom.getDomHelper(elem);
<a name="line313"></a>  var controls = [];
<a name="line314"></a>
<a name="line315"></a>  for (var i = 0, button; button = items[i]; i++) {
<a name="line316"></a>    if (goog.isString(button)) {
<a name="line317"></a>      button = goog.ui.editor.DefaultToolbar.makeBuiltInToolbarButton(button,
<a name="line318"></a>          domHelper);
<a name="line319"></a>    }
<a name="line320"></a>    if (button) {
<a name="line321"></a>      controls.push(button);
<a name="line322"></a>    }
<a name="line323"></a>  }
<a name="line324"></a>
<a name="line325"></a>  return goog.ui.editor.ToolbarFactory.makeToolbar(controls, elem,
<a name="line326"></a>      opt_isRightToLeft);
<a name="line327"></a>};
<a name="line328"></a>
<a name="line329"></a>
<a name="line330"></a>/**
<a name="line331"></a> * Creates an instance of a subclass of {@link goog.ui.Button} for the given
<a name="line332"></a> * {@link goog.editor.Command}, or null if no built-in button exists for the
<a name="line333"></a> * command.  Note that this function is only intended to create built-in
<a name="line334"></a> * buttons; please don&#39;t try to hack it!
<a name="line335"></a> * @param {string} command Editor command ID.
<a name="line336"></a> * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for DOM
<a name="line337"></a> *     creation; defaults to the current document if unspecified.
<a name="line338"></a> * @return {goog.ui.Button} Toolbar button (null if no built-in button exists
<a name="line339"></a> *     for the command).
<a name="line340"></a> */
<a name="line341"></a>goog.ui.editor.DefaultToolbar.makeBuiltInToolbarButton = function(command,
<a name="line342"></a>    opt_domHelper) {
<a name="line343"></a>  var button;
<a name="line344"></a>  var descriptor = goog.ui.editor.DefaultToolbar.buttons_[command];
<a name="line345"></a>  if (descriptor) {
<a name="line346"></a>    // Default the factory method to makeToggleButton, since most built-in
<a name="line347"></a>    // toolbar buttons are toggle buttons. See also
<a name="line348"></a>    // goog.ui.editor.DefaultToolbar.BUTTONS_.
<a name="line349"></a>    var factory = descriptor.factory ||
<a name="line350"></a>        goog.ui.editor.ToolbarFactory.makeToggleButton;
<a name="line351"></a>    var id = descriptor.command;
<a name="line352"></a>    var tooltip = descriptor.tooltip;
<a name="line353"></a>    var caption = descriptor.caption;
<a name="line354"></a>    var classNames = descriptor.classes;
<a name="line355"></a>    // Default the DOM helper to the one for the current document.
<a name="line356"></a>    var domHelper = opt_domHelper || goog.dom.getDomHelper();
<a name="line357"></a>    // Instantiate the button based on the descriptor.
<a name="line358"></a>    button = factory(id, tooltip, caption, classNames, null, domHelper);
<a name="line359"></a>    // If this button&#39;s state should be queried when updating the toolbar,
<a name="line360"></a>    // set the button object&#39;s queryable property to true.
<a name="line361"></a>    if (descriptor.queryable) {
<a name="line362"></a>      button.queryable = true;
<a name="line363"></a>    }
<a name="line364"></a>  }
<a name="line365"></a>  return button;
<a name="line366"></a>};
<a name="line367"></a>
<a name="line368"></a>
<a name="line369"></a>/**
<a name="line370"></a> * A set of built-in buttons to display in the default editor toolbar.
<a name="line371"></a> * @type {!Array.&lt;string&gt;}
<a name="line372"></a> */
<a name="line373"></a>goog.ui.editor.DefaultToolbar.DEFAULT_BUTTONS = [
<a name="line374"></a>  goog.editor.Command.IMAGE,
<a name="line375"></a>  goog.editor.Command.LINK,
<a name="line376"></a>  goog.editor.Command.BOLD,
<a name="line377"></a>  goog.editor.Command.ITALIC,
<a name="line378"></a>  goog.editor.Command.UNORDERED_LIST,
<a name="line379"></a>  goog.editor.Command.FONT_COLOR,
<a name="line380"></a>  goog.editor.Command.FONT_FACE,
<a name="line381"></a>  goog.editor.Command.FONT_SIZE,
<a name="line382"></a>  goog.editor.Command.JUSTIFY_LEFT,
<a name="line383"></a>  goog.editor.Command.JUSTIFY_CENTER,
<a name="line384"></a>  goog.editor.Command.JUSTIFY_RIGHT,
<a name="line385"></a>  goog.editor.Command.EDIT_HTML
<a name="line386"></a>];
<a name="line387"></a>
<a name="line388"></a>
<a name="line389"></a>/**
<a name="line390"></a> * A set of built-in buttons to display in the default editor toolbar when
<a name="line391"></a> * the editor chrome is right-to-left (BiDi mode only).
<a name="line392"></a> * @type {!Array.&lt;string&gt;}
<a name="line393"></a> */
<a name="line394"></a>goog.ui.editor.DefaultToolbar.DEFAULT_BUTTONS_RTL = [
<a name="line395"></a>  goog.editor.Command.IMAGE,
<a name="line396"></a>  goog.editor.Command.LINK,
<a name="line397"></a>  goog.editor.Command.BOLD,
<a name="line398"></a>  goog.editor.Command.ITALIC,
<a name="line399"></a>  goog.editor.Command.UNORDERED_LIST,
<a name="line400"></a>  goog.editor.Command.FONT_COLOR,
<a name="line401"></a>  goog.editor.Command.FONT_FACE,
<a name="line402"></a>  goog.editor.Command.FONT_SIZE,
<a name="line403"></a>  goog.editor.Command.JUSTIFY_RIGHT,
<a name="line404"></a>  goog.editor.Command.JUSTIFY_CENTER,
<a name="line405"></a>  goog.editor.Command.JUSTIFY_LEFT,
<a name="line406"></a>  goog.editor.Command.DIR_RTL,
<a name="line407"></a>  goog.editor.Command.DIR_LTR,
<a name="line408"></a>  goog.editor.Command.EDIT_HTML
<a name="line409"></a>];
<a name="line410"></a>
<a name="line411"></a>
<a name="line412"></a>/**
<a name="line413"></a> * Creates a toolbar button with the given ID, tooltip, and caption.  Applies
<a name="line414"></a> * any custom CSS class names to the button&#39;s caption element.  This button
<a name="line415"></a> * is designed to be used as the RTL button.
<a name="line416"></a> * @param {string} id Button ID; must equal a {@link goog.editor.Command} for
<a name="line417"></a> *     built-in buttons, anything else for custom buttons.
<a name="line418"></a> * @param {string} tooltip Tooltip to be shown on hover.
<a name="line419"></a> * @param {goog.ui.ControlContent} caption Button caption.
<a name="line420"></a> * @param {string=} opt_classNames CSS class name(s) to apply to the caption
<a name="line421"></a> *     element.
<a name="line422"></a> * @param {goog.ui.ButtonRenderer=} opt_renderer Button renderer; defaults to
<a name="line423"></a> *     {@link goog.ui.ToolbarButtonRenderer} if unspecified.
<a name="line424"></a> * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for DOM
<a name="line425"></a> *     creation; defaults to the current document if unspecified.
<a name="line426"></a> * @return {!goog.ui.Button} A toolbar button.
<a name="line427"></a> * @private
<a name="line428"></a> */
<a name="line429"></a>goog.ui.editor.DefaultToolbar.rtlButtonFactory_ = function(id, tooltip,
<a name="line430"></a>    caption, opt_classNames, opt_renderer, opt_domHelper) {
<a name="line431"></a>  var button = goog.ui.editor.ToolbarFactory.makeToggleButton(id, tooltip,
<a name="line432"></a>      caption, opt_classNames, opt_renderer, opt_domHelper);
<a name="line433"></a>  button.updateFromValue = function(value) {
<a name="line434"></a>    // Enable/disable right-to-left text editing mode in the toolbar.
<a name="line435"></a>    var isRtl = !!value;
<a name="line436"></a>    // Enable/disable a marker class on the toolbar&#39;s root element; the rest is
<a name="line437"></a>    // done using CSS scoping in editortoolbar.css.  This changes
<a name="line438"></a>    // direction-senitive toolbar icons (like indent/outdent)
<a name="line439"></a>    goog.dom.classes.enable(
<a name="line440"></a>        button.getParent().getElement(), goog.getCssName(&#39;tr-rtl-mode&#39;), isRtl);
<a name="line441"></a>    button.setChecked(isRtl);
<a name="line442"></a>  }
<a name="line443"></a>  return button;
<a name="line444"></a>};
<a name="line445"></a>
<a name="line446"></a>
<a name="line447"></a>/**
<a name="line448"></a> * Creates a toolbar button with the given ID, tooltip, and caption.  Applies
<a name="line449"></a> * any custom CSS class names to the button&#39;s caption element.  Designed to
<a name="line450"></a> * be used to create undo and redo buttons.
<a name="line451"></a> * @param {string} id Button ID; must equal a {@link goog.editor.Command} for
<a name="line452"></a> *     built-in buttons, anything else for custom buttons.
<a name="line453"></a> * @param {string} tooltip Tooltip to be shown on hover.
<a name="line454"></a> * @param {goog.ui.ControlContent} caption Button caption.
<a name="line455"></a> * @param {string=} opt_classNames CSS class name(s) to apply to the caption
<a name="line456"></a> *     element.
<a name="line457"></a> * @param {goog.ui.ButtonRenderer=} opt_renderer Button renderer; defaults to
<a name="line458"></a> *     {@link goog.ui.ToolbarButtonRenderer} if unspecified.
<a name="line459"></a> * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for DOM
<a name="line460"></a> *     creation; defaults to the current document if unspecified.
<a name="line461"></a> * @return {!goog.ui.Button} A toolbar button.
<a name="line462"></a> * @private
<a name="line463"></a> */
<a name="line464"></a>goog.ui.editor.DefaultToolbar.undoRedoButtonFactory_ = function(id, tooltip,
<a name="line465"></a>    caption, opt_classNames, opt_renderer, opt_domHelper) {
<a name="line466"></a>  var button = goog.ui.editor.ToolbarFactory.makeButton(id, tooltip,
<a name="line467"></a>      caption, opt_classNames, opt_renderer, opt_domHelper);
<a name="line468"></a>  button.updateFromValue = function(value) {
<a name="line469"></a>    button.setEnabled(value);
<a name="line470"></a>  }
<a name="line471"></a>  return button;
<a name="line472"></a>};
<a name="line473"></a>
<a name="line474"></a>
<a name="line475"></a>/**
<a name="line476"></a> * Creates a toolbar button with the given ID, tooltip, and caption.  Applies
<a name="line477"></a> * any custom CSS class names to the button&#39;s caption element.  Used to create
<a name="line478"></a> * a font face button, filled with default fonts.
<a name="line479"></a> * @param {string} id Button ID; must equal a {@link goog.editor.Command} for
<a name="line480"></a> *     built-in buttons, anything else for custom buttons.
<a name="line481"></a> * @param {string} tooltip Tooltip to be shown on hover.
<a name="line482"></a> * @param {goog.ui.ControlContent} caption Button caption.
<a name="line483"></a> * @param {string=} opt_classNames CSS class name(s) to apply to the caption
<a name="line484"></a> *     element.
<a name="line485"></a> * @param {goog.ui.MenuButtonRenderer=} opt_renderer Button renderer; defaults
<a name="line486"></a> *     to {@link goog.ui.ToolbarMenuButtonRenderer} if unspecified.
<a name="line487"></a> * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for DOM
<a name="line488"></a> *     creation; defaults to the current document if unspecified.
<a name="line489"></a> * @return {!goog.ui.Button} A toolbar button.
<a name="line490"></a> * @private
<a name="line491"></a> */
<a name="line492"></a>goog.ui.editor.DefaultToolbar.fontFaceFactory_ = function(id, tooltip,
<a name="line493"></a>    caption, opt_classNames, opt_renderer, opt_domHelper) {
<a name="line494"></a>  var button = goog.ui.editor.ToolbarFactory.makeSelectButton(id, tooltip,
<a name="line495"></a>      caption, opt_classNames, opt_renderer, opt_domHelper);
<a name="line496"></a>  goog.ui.editor.DefaultToolbar.addDefaultFonts(button);
<a name="line497"></a>  button.setDefaultCaption(goog.ui.editor.DefaultToolbar.MSG_FONT_NORMAL);
<a name="line498"></a>  // Font options don&#39;t have keyboard accelerators.
<a name="line499"></a>  goog.dom.classes.add(button.getMenu().getContentElement(),
<a name="line500"></a>      goog.getCssName(&#39;goog-menu-noaccel&#39;));
<a name="line501"></a>
<a name="line502"></a>  // How to update this button&#39;s state.
<a name="line503"></a>  button.updateFromValue = function(value) {
<a name="line504"></a>    // Normalize value to null or a non-empty string (sometimes we get
<a name="line505"></a>    // the empty string, sometimes we get false...), extract the substring
<a name="line506"></a>    // up to the first comma to get the primary font name, and normalize
<a name="line507"></a>    // to lowercase.  This allows us to map a font spec like &quot;Arial,
<a name="line508"></a>    // Helvetica, sans-serif&quot; to a font menu item.
<a name="line509"></a>    // TODO (attila): Try to make this more robust.
<a name="line510"></a>    var item = null;
<a name="line511"></a>    if (value &amp;&amp; value.length &gt; 0) {
<a name="line512"></a>      item = /** @type {goog.ui.MenuItem} */ (button.getMenu().getChild(
<a name="line513"></a>          goog.ui.editor.ToolbarFactory.getPrimaryFont(value)));
<a name="line514"></a>    }
<a name="line515"></a>    var selectedItem = button.getSelectedItem();
<a name="line516"></a>    if (item != selectedItem) {
<a name="line517"></a>      button.setSelectedItem(item);
<a name="line518"></a>    }
<a name="line519"></a>  }
<a name="line520"></a>  return button;
<a name="line521"></a>};
<a name="line522"></a>
<a name="line523"></a>
<a name="line524"></a>/**
<a name="line525"></a> * Creates a toolbar button with the given ID, tooltip, and caption.  Applies
<a name="line526"></a> * any custom CSS class names to the button&#39;s caption element. Use to create a
<a name="line527"></a> * font size button, filled with default font sizes.
<a name="line528"></a> * @param {string} id Button ID; must equal a {@link goog.editor.Command} for
<a name="line529"></a> *     built-in buttons, anything else for custom buttons.
<a name="line530"></a> * @param {string} tooltip Tooltip to be shown on hover.
<a name="line531"></a> * @param {goog.ui.ControlContent} caption Button caption.
<a name="line532"></a> * @param {string=} opt_classNames CSS class name(s) to apply to the caption
<a name="line533"></a> *     element.
<a name="line534"></a> * @param {goog.ui.MenuButtonRenderer=} opt_renderer Button renderer; defaults
<a name="line535"></a> *     to {@link goog.ui.ToolbarMebuButtonRenderer} if unspecified.
<a name="line536"></a> * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for DOM
<a name="line537"></a> *     creation; defaults to the current document if unspecified.
<a name="line538"></a> * @return {!goog.ui.Button} A toolbar button.
<a name="line539"></a> * @private
<a name="line540"></a> */
<a name="line541"></a>goog.ui.editor.DefaultToolbar.fontSizeFactory_ = function(id, tooltip,
<a name="line542"></a>    caption, opt_classNames, opt_renderer, opt_domHelper) {
<a name="line543"></a>  var button = goog.ui.editor.ToolbarFactory.makeSelectButton(id, tooltip,
<a name="line544"></a>      caption, opt_classNames, opt_renderer, opt_domHelper);
<a name="line545"></a>  goog.ui.editor.DefaultToolbar.addDefaultFontSizes(button);
<a name="line546"></a>  button.setDefaultCaption(goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_NORMAL);
<a name="line547"></a>  // Font size options don&#39;t have keyboard accelerators.
<a name="line548"></a>  goog.dom.classes.add(button.getMenu().getContentElement(),
<a name="line549"></a>      goog.getCssName(&#39;goog-menu-noaccel&#39;));
<a name="line550"></a>  // How to update this button&#39;s state.
<a name="line551"></a>  button.updateFromValue = function(value) {
<a name="line552"></a>    // Webkit pre-534.7 returns a string like &#39;32px&#39; instead of the equivalent
<a name="line553"></a>    // integer, so normalize that first.
<a name="line554"></a>    // NOTE(user): Gecko returns &quot;6&quot; so can&#39;t just normalize all
<a name="line555"></a>    // strings, only ones ending in &quot;px&quot;.
<a name="line556"></a>    if (goog.isString(value) &amp;&amp;
<a name="line557"></a>        goog.style.getLengthUnits(value) == &#39;px&#39;) {
<a name="line558"></a>      value = goog.ui.editor.ToolbarFactory.getLegacySizeFromPx(
<a name="line559"></a>          parseInt(value, 10));
<a name="line560"></a>    }
<a name="line561"></a>    // Normalize value to null or a positive integer (sometimes we get
<a name="line562"></a>    // the empty string, sometimes we get false, or -1 if the above
<a name="line563"></a>    // normalization didn&#39;t match to a particular 0-7 size)
<a name="line564"></a>    value = value &gt; 0 ? value : null;
<a name="line565"></a>    if (value != button.getValue()) {
<a name="line566"></a>      button.setValue(value);
<a name="line567"></a>    }
<a name="line568"></a>  }
<a name="line569"></a>  return button;
<a name="line570"></a>};
<a name="line571"></a>
<a name="line572"></a>
<a name="line573"></a>/**
<a name="line574"></a> * Function to update the state of a color menu button.
<a name="line575"></a> * @param {goog.ui.ToolbarColorMenuButton} button The button to which the
<a name="line576"></a> *     color menu is attached.
<a name="line577"></a> * @param {number} color Color value to update to.
<a name="line578"></a> * @private
<a name="line579"></a> */
<a name="line580"></a>goog.ui.editor.DefaultToolbar.colorUpdateFromValue_ = function(button, color) {
<a name="line581"></a>  var value = color;
<a name="line582"></a>  /** @preserveTry */
<a name="line583"></a>  try {
<a name="line584"></a>    if (goog.userAgent.IE) {
<a name="line585"></a>      // IE returns a number that, converted to hex, is a BGR color.
<a name="line586"></a>      // Convert from decimal to BGR to RGB.
<a name="line587"></a>      var hex = &#39;000000&#39; + value.toString(16);
<a name="line588"></a>      var bgr = hex.substr(hex.length - 6, 6);
<a name="line589"></a>      value = &#39;#&#39; + bgr.substring(4, 6) + bgr.substring(2, 4) +
<a name="line590"></a>          bgr.substring(0, 2);
<a name="line591"></a>    }
<a name="line592"></a>    if (value != button.getValue()) {
<a name="line593"></a>      button.setValue(/** @type {string} */ (value));
<a name="line594"></a>    }
<a name="line595"></a>  } catch (ex) {
<a name="line596"></a>    // TODO(attila): Find out when/why this happens.
<a name="line597"></a>  }
<a name="line598"></a>};
<a name="line599"></a>
<a name="line600"></a>
<a name="line601"></a>/**
<a name="line602"></a> * Creates a toolbar button with the given ID, tooltip, and caption.  Applies
<a name="line603"></a> * any custom CSS class names to the button&#39;s caption element. Use to create
<a name="line604"></a> * a font color button.
<a name="line605"></a> * @param {string} id Button ID; must equal a {@link goog.editor.Command} for
<a name="line606"></a> *     built-in buttons, anything else for custom buttons.
<a name="line607"></a> * @param {string} tooltip Tooltip to be shown on hover.
<a name="line608"></a> * @param {goog.ui.ControlContent} caption Button caption.
<a name="line609"></a> * @param {string=} opt_classNames CSS class name(s) to apply to the caption
<a name="line610"></a> *     element.
<a name="line611"></a> * @param {goog.ui.ColorMenuButtonRenderer=} opt_renderer Button renderer;
<a name="line612"></a> *     defaults to {@link goog.ui.ToolbarColorMenuButtonRenderer} if
<a name="line613"></a> *     unspecified.
<a name="line614"></a> * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for DOM
<a name="line615"></a> *     creation; defaults to the current document if unspecified.
<a name="line616"></a> * @return {!goog.ui.Button} A toolbar button.
<a name="line617"></a> * @private
<a name="line618"></a> */
<a name="line619"></a>goog.ui.editor.DefaultToolbar.fontColorFactory_ = function(id, tooltip,
<a name="line620"></a>    caption, opt_classNames, opt_renderer, opt_domHelper) {
<a name="line621"></a>  var button = goog.ui.editor.ToolbarFactory.makeColorMenuButton(id, tooltip,
<a name="line622"></a>      caption, opt_classNames, opt_renderer, opt_domHelper);
<a name="line623"></a>  // Initialize default foreground color.
<a name="line624"></a>  button.setSelectedColor(&#39;#000&#39;);
<a name="line625"></a>  button.updateFromValue = goog.partial(
<a name="line626"></a>      goog.ui.editor.DefaultToolbar.colorUpdateFromValue_, button);
<a name="line627"></a>  return button;
<a name="line628"></a>};
<a name="line629"></a>
<a name="line630"></a>
<a name="line631"></a>/**
<a name="line632"></a> * Creates a toolbar button with the given ID, tooltip, and caption.  Applies
<a name="line633"></a> * any custom CSS class names to the button&#39;s caption element. Use to create
<a name="line634"></a> * a font background color button.
<a name="line635"></a> * @param {string} id Button ID; must equal a {@link goog.editor.Command} for
<a name="line636"></a> *     built-in buttons, anything else for custom buttons.
<a name="line637"></a> * @param {string} tooltip Tooltip to be shown on hover.
<a name="line638"></a> * @param {goog.ui.ControlContent} caption Button caption.
<a name="line639"></a> * @param {string=} opt_classNames CSS class name(s) to apply to the caption
<a name="line640"></a> *     element.
<a name="line641"></a> * @param {goog.ui.ColorMenuButtonRenderer=} opt_renderer Button renderer;
<a name="line642"></a> *     defaults to {@link goog.ui.ToolbarColorMenuButtonRenderer} if
<a name="line643"></a> *     unspecified.
<a name="line644"></a> * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for DOM
<a name="line645"></a> *     creation; defaults to the current document if unspecified.
<a name="line646"></a> * @return {!goog.ui.Button} A toolbar button.
<a name="line647"></a> * @private
<a name="line648"></a> */
<a name="line649"></a>goog.ui.editor.DefaultToolbar.backgroundColorFactory_ = function(id, tooltip,
<a name="line650"></a>    caption, opt_classNames, opt_renderer, opt_domHelper) {
<a name="line651"></a>  var button = goog.ui.editor.ToolbarFactory.makeColorMenuButton(id,
<a name="line652"></a>      tooltip, caption, opt_classNames, opt_renderer, opt_domHelper);
<a name="line653"></a>  // Initialize default background color.
<a name="line654"></a>  button.setSelectedColor(&#39;#FFF&#39;);
<a name="line655"></a>  button.updateFromValue = goog.partial(
<a name="line656"></a>      goog.ui.editor.DefaultToolbar.colorUpdateFromValue_, button);
<a name="line657"></a>  return button;
<a name="line658"></a>};
<a name="line659"></a>
<a name="line660"></a>
<a name="line661"></a>/**
<a name="line662"></a> * Creates a toolbar button with the given ID, tooltip, and caption.  Applies
<a name="line663"></a> * any custom CSS class names to the button&#39;s caption element. Use to create
<a name="line664"></a> * the format menu, prefilled with default formats.
<a name="line665"></a> * @param {string} id Button ID; must equal a {@link goog.editor.Command} for
<a name="line666"></a> *     built-in buttons, anything else for custom buttons.
<a name="line667"></a> * @param {string} tooltip Tooltip to be shown on hover.
<a name="line668"></a> * @param {goog.ui.ControlContent} caption Button caption.
<a name="line669"></a> * @param {string=} opt_classNames CSS class name(s) to apply to the caption
<a name="line670"></a> *     element.
<a name="line671"></a> * @param {goog.ui.MenuButtonRenderer=} opt_renderer Button renderer;
<a name="line672"></a> *     defaults to
<a name="line673"></a> *     {@link goog.ui.ToolbarMenuButtonRenderer} if unspecified.
<a name="line674"></a> * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for DOM
<a name="line675"></a> *     creation; defaults to the current document if unspecified.
<a name="line676"></a> * @return {!goog.ui.Button} A toolbar button.
<a name="line677"></a> * @private
<a name="line678"></a> */
<a name="line679"></a>goog.ui.editor.DefaultToolbar.formatBlockFactory_ = function(id, tooltip,
<a name="line680"></a>    caption, opt_classNames, opt_renderer, opt_domHelper) {
<a name="line681"></a>  var button = goog.ui.editor.ToolbarFactory.makeSelectButton(id, tooltip,
<a name="line682"></a>      caption, opt_classNames, opt_renderer, opt_domHelper);
<a name="line683"></a>  goog.ui.editor.DefaultToolbar.addDefaultFormatOptions(button);
<a name="line684"></a>  button.setDefaultCaption(goog.ui.editor.DefaultToolbar.MSG_FORMAT_NORMAL);
<a name="line685"></a>  // Format options don&#39;t have keyboard accelerators.
<a name="line686"></a>  goog.dom.classes.add(button.getMenu().getContentElement(),
<a name="line687"></a>      goog.getCssName(&#39;goog-menu-noaccel&#39;));
<a name="line688"></a>  // How to update this button.
<a name="line689"></a>  button.updateFromValue = function(value) {
<a name="line690"></a>    // Normalize value to null or a nonempty string (sometimes we get
<a name="line691"></a>    // the empty string, sometimes we get false...)
<a name="line692"></a>    value = value &amp;&amp; value.length &gt; 0 ? value : null;
<a name="line693"></a>    if (value != button.getValue()) {
<a name="line694"></a>      button.setValue(value);
<a name="line695"></a>     }
<a name="line696"></a>  }
<a name="line697"></a>  return button;
<a name="line698"></a>};
<a name="line699"></a>
<a name="line700"></a>
<a name="line701"></a>// Messages used for tooltips and captions.
<a name="line702"></a>
<a name="line703"></a>
<a name="line704"></a>/** @desc Format menu tooltip. */
<a name="line705"></a>goog.ui.editor.DefaultToolbar.MSG_FORMAT_BLOCK_TITLE = goog.getMsg(&#39;Format&#39;);
<a name="line706"></a>
<a name="line707"></a>
<a name="line708"></a>/** @desc Format menu caption. */
<a name="line709"></a>goog.ui.editor.DefaultToolbar.MSG_FORMAT_BLOCK_CAPTION = goog.getMsg(&#39;Format&#39;);
<a name="line710"></a>
<a name="line711"></a>
<a name="line712"></a>/** @desc Undo button tooltip. */
<a name="line713"></a>goog.ui.editor.DefaultToolbar.MSG_UNDO_TITLE = goog.getMsg(&#39;Undo&#39;);
<a name="line714"></a>
<a name="line715"></a>
<a name="line716"></a>/** @desc Redo button tooltip. */
<a name="line717"></a>goog.ui.editor.DefaultToolbar.MSG_REDO_TITLE = goog.getMsg(&#39;Redo&#39;);
<a name="line718"></a>
<a name="line719"></a>
<a name="line720"></a>/** @desc Font menu tooltip. */
<a name="line721"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_FACE_TITLE = goog.getMsg(&#39;Font&#39;);
<a name="line722"></a>
<a name="line723"></a>
<a name="line724"></a>/** @desc Font size menu tooltip. */
<a name="line725"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_TITLE = goog.getMsg(&#39;Font size&#39;);
<a name="line726"></a>
<a name="line727"></a>
<a name="line728"></a>/** @desc Text foreground color menu tooltip. */
<a name="line729"></a>goog.ui.editor.DefaultToolbar.MSG_FONT_COLOR_TITLE = goog.getMsg(&#39;Text color&#39;);
<a name="line730"></a>
<a name="line731"></a>
<a name="line732"></a>/** @desc Bold button tooltip. */
<a name="line733"></a>goog.ui.editor.DefaultToolbar.MSG_BOLD_TITLE = goog.getMsg(&#39;Bold&#39;);
<a name="line734"></a>
<a name="line735"></a>
<a name="line736"></a>/** @desc Italic button tooltip. */
<a name="line737"></a>goog.ui.editor.DefaultToolbar.MSG_ITALIC_TITLE = goog.getMsg(&#39;Italic&#39;);
<a name="line738"></a>
<a name="line739"></a>
<a name="line740"></a>/** @desc Underline button tooltip. */
<a name="line741"></a>goog.ui.editor.DefaultToolbar.MSG_UNDERLINE_TITLE = goog.getMsg(&#39;Underline&#39;);
<a name="line742"></a>
<a name="line743"></a>
<a name="line744"></a>/** @desc Text background color menu tooltip. */
<a name="line745"></a>goog.ui.editor.DefaultToolbar.MSG_BACKGROUND_COLOR_TITLE =
<a name="line746"></a>    goog.getMsg(&#39;Text background color&#39;);
<a name="line747"></a>
<a name="line748"></a>
<a name="line749"></a>/** @desc Link button tooltip. */
<a name="line750"></a>goog.ui.editor.DefaultToolbar.MSG_LINK_TITLE =
<a name="line751"></a>    goog.getMsg(&#39;Add or remove link&#39;);
<a name="line752"></a>
<a name="line753"></a>
<a name="line754"></a>/** @desc Numbered list button tooltip. */
<a name="line755"></a>goog.ui.editor.DefaultToolbar.MSG_ORDERED_LIST_TITLE =
<a name="line756"></a>    goog.getMsg(&#39;Numbered list&#39;);
<a name="line757"></a>
<a name="line758"></a>
<a name="line759"></a>/** @desc Bullet list button tooltip. */
<a name="line760"></a>goog.ui.editor.DefaultToolbar.MSG_UNORDERED_LIST_TITLE =
<a name="line761"></a>    goog.getMsg(&#39;Bullet list&#39;);
<a name="line762"></a>
<a name="line763"></a>
<a name="line764"></a>/** @desc Outdent button tooltip. */
<a name="line765"></a>goog.ui.editor.DefaultToolbar.MSG_OUTDENT_TITLE =
<a name="line766"></a>    goog.getMsg(&#39;Decrease indent&#39;);
<a name="line767"></a>
<a name="line768"></a>
<a name="line769"></a>/** @desc Indent button tooltip. */
<a name="line770"></a>goog.ui.editor.DefaultToolbar.MSG_INDENT_TITLE = goog.getMsg(&#39;Increase indent&#39;);
<a name="line771"></a>
<a name="line772"></a>
<a name="line773"></a>/** @desc Align left button tooltip. */
<a name="line774"></a>goog.ui.editor.DefaultToolbar.MSG_ALIGN_LEFT_TITLE = goog.getMsg(&#39;Align left&#39;);
<a name="line775"></a>
<a name="line776"></a>
<a name="line777"></a>/** @desc Align center button tooltip. */
<a name="line778"></a>goog.ui.editor.DefaultToolbar.MSG_ALIGN_CENTER_TITLE =
<a name="line779"></a>    goog.getMsg(&#39;Align center&#39;);
<a name="line780"></a>
<a name="line781"></a>
<a name="line782"></a>/** @desc Align right button tooltip. */
<a name="line783"></a>goog.ui.editor.DefaultToolbar.MSG_ALIGN_RIGHT_TITLE =
<a name="line784"></a>    goog.getMsg(&#39;Align right&#39;);
<a name="line785"></a>
<a name="line786"></a>
<a name="line787"></a>/** @desc Justify button tooltip. */
<a name="line788"></a>goog.ui.editor.DefaultToolbar.MSG_JUSTIFY_TITLE = goog.getMsg(&#39;Justify&#39;);
<a name="line789"></a>
<a name="line790"></a>
<a name="line791"></a>/** @desc Remove formatting button tooltip. */
<a name="line792"></a>goog.ui.editor.DefaultToolbar.MSG_REMOVE_FORMAT_TITLE =
<a name="line793"></a>    goog.getMsg(&#39;Remove formatting&#39;);
<a name="line794"></a>
<a name="line795"></a>
<a name="line796"></a>/** @desc Insert image button tooltip. */
<a name="line797"></a>goog.ui.editor.DefaultToolbar.MSG_IMAGE_TITLE = goog.getMsg(&#39;Insert image&#39;);
<a name="line798"></a>
<a name="line799"></a>
<a name="line800"></a>/** @desc Strike through button tooltip. */
<a name="line801"></a>goog.ui.editor.DefaultToolbar.MSG_STRIKE_THROUGH_TITLE =
<a name="line802"></a>    goog.getMsg(&#39;Strikethrough&#39;);
<a name="line803"></a>
<a name="line804"></a>
<a name="line805"></a>/** @desc Left-to-right button tooltip. */
<a name="line806"></a>goog.ui.editor.DefaultToolbar.MSG_DIR_LTR_TITLE = goog.getMsg(&#39;Left-to-right&#39;);
<a name="line807"></a>
<a name="line808"></a>
<a name="line809"></a>/** @desc Right-to-left button tooltip. */
<a name="line810"></a>goog.ui.editor.DefaultToolbar.MSG_DIR_RTL_TITLE = goog.getMsg(&#39;Right-to-left&#39;);
<a name="line811"></a>
<a name="line812"></a>
<a name="line813"></a>/** @desc Blockquote button tooltip. */
<a name="line814"></a>goog.ui.editor.DefaultToolbar.MSG_BLOCKQUOTE_TITLE = goog.getMsg(&#39;Quote&#39;);
<a name="line815"></a>
<a name="line816"></a>
<a name="line817"></a>/** @desc Edit HTML button tooltip. */
<a name="line818"></a>goog.ui.editor.DefaultToolbar.MSG_EDIT_HTML_TITLE =
<a name="line819"></a>    goog.getMsg(&#39;Edit HTML source&#39;);
<a name="line820"></a>
<a name="line821"></a>
<a name="line822"></a>/** @desc Subscript button tooltip. */
<a name="line823"></a>goog.ui.editor.DefaultToolbar.MSG_SUBSCRIPT = goog.getMsg(&#39;Subscript&#39;);
<a name="line824"></a>
<a name="line825"></a>
<a name="line826"></a>/** @desc Superscript button tooltip. */
<a name="line827"></a>goog.ui.editor.DefaultToolbar.MSG_SUPERSCRIPT = goog.getMsg(&#39;Superscript&#39;);
<a name="line828"></a>
<a name="line829"></a>
<a name="line830"></a>/** @desc Edit HTML button caption. */
<a name="line831"></a>goog.ui.editor.DefaultToolbar.MSG_EDIT_HTML_CAPTION = goog.getMsg(&#39;Edit HTML&#39;);
<a name="line832"></a>
<a name="line833"></a>
<a name="line834"></a>/**
<a name="line835"></a> * Map of {@code goog.editor.Command}s to toolbar button descriptor objects,
<a name="line836"></a> * each of which has the following attributes:
<a name="line837"></a> * &lt;ul&gt;
<a name="line838"></a> *   &lt;li&gt;{@code command} - The command corresponding to the
<a name="line839"></a> *       button (mandatory)
<a name="line840"></a> *   &lt;li&gt;{@code tooltip} - Tooltip text (optional); if unspecified, the button
<a name="line841"></a> *       has no hover text
<a name="line842"></a> *   &lt;li&gt;{@code caption} - Caption to display on the button (optional); if
<a name="line843"></a> *       unspecified, the button has no text caption
<a name="line844"></a> *   &lt;li&gt;{@code classes} - CSS class name(s) to be applied to the button&#39;s
<a name="line845"></a> *       element when rendered (optional); if unspecified, defaults to
<a name="line846"></a> *       &#39;tr-icon&#39;
<a name="line847"></a> *       plus &#39;tr-&#39; followed by the command ID, but without any leading &#39;+&#39;
<a name="line848"></a> *       character (e.g. if the command ID is &#39;+undo&#39;, then {@code classes}
<a name="line849"></a> *       defaults to &#39;tr-icon tr-undo&#39;)
<a name="line850"></a> *   &lt;li&gt;{@code factory} - factory function used to create the button, which
<a name="line851"></a> *       must accept {@code id}, {@code tooltip}, {@code caption}, and
<a name="line852"></a> *       {@code classes} as arguments, and must return an instance of
<a name="line853"></a> *       {@link goog.ui.Button} or an appropriate subclass (optional); if
<a name="line854"></a> *       unspecified, defaults to
<a name="line855"></a> *       {@link goog.ui.editor.DefaultToolbar.makeToggleButton},
<a name="line856"></a> *       since most built-in toolbar buttons are toggle buttons
<a name="line857"></a> *   &lt;li&gt;(@code queryable} - Whether the button&#39;s state should be queried
<a name="line858"></a> *       when updating the toolbar (optional).
<a name="line859"></a> * &lt;/ul&gt;
<a name="line860"></a> * Note that this object is only used for creating toolbar buttons for
<a name="line861"></a> * built-in editor commands; custom buttons aren&#39;t listed here.  Please don&#39;t
<a name="line862"></a> * try to hack this!
<a name="line863"></a> * @type {Object.&lt;!goog.ui.editor.ButtonDescriptor&gt;}.
<a name="line864"></a> * @private
<a name="line865"></a> */
<a name="line866"></a>goog.ui.editor.DefaultToolbar.buttons_ = {};
<a name="line867"></a>
<a name="line868"></a>
<a name="line869"></a>/**
<a name="line870"></a> * @typedef {{command: string, tooltip: ?string,
<a name="line871"></a> *   caption: ?goog.ui.ControlContent, classes: ?string,
<a name="line872"></a> *   factory: ?function(string, string, goog.ui.ControlContent, ?string,
<a name="line873"></a> *       goog.ui.ButtonRenderer, goog.dom.DomHelper):goog.ui.Button,
<a name="line874"></a> *   queryable:?boolean}}
<a name="line875"></a> */
<a name="line876"></a>goog.ui.editor.ButtonDescriptor;
<a name="line877"></a>
<a name="line878"></a>
<a name="line879"></a>/**
<a name="line880"></a> * Built-in toolbar button descriptors.  See
<a name="line881"></a> * {@link goog.ui.editor.DefaultToolbar.buttons_} for details on button
<a name="line882"></a> * descriptor objects.  This array is processed at JS parse time; each item is
<a name="line883"></a> * inserted into {@link goog.ui.editor.DefaultToolbar.buttons_}, and the array
<a name="line884"></a> * itself is deleted and (hopefully) garbage-collected.
<a name="line885"></a> * @type {Array.&lt;!goog.ui.editor.ButtonDescriptor&gt;}.
<a name="line886"></a> * @private
<a name="line887"></a> */
<a name="line888"></a>goog.ui.editor.DefaultToolbar.BUTTONS_ = [{
<a name="line889"></a>  command: goog.editor.Command.UNDO,
<a name="line890"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_UNDO_TITLE,
<a name="line891"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-undo&#39;),
<a name="line892"></a>  factory: goog.ui.editor.DefaultToolbar.undoRedoButtonFactory_,
<a name="line893"></a>  queryable: true
<a name="line894"></a>}, {
<a name="line895"></a>  command: goog.editor.Command.REDO,
<a name="line896"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_REDO_TITLE,
<a name="line897"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-redo&#39;),
<a name="line898"></a>  factory: goog.ui.editor.DefaultToolbar.undoRedoButtonFactory_,
<a name="line899"></a>  queryable: true
<a name="line900"></a>}, {
<a name="line901"></a>  command: goog.editor.Command.FONT_FACE,
<a name="line902"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_FONT_FACE_TITLE,
<a name="line903"></a>  classes: goog.getCssName(&#39;tr-fontName&#39;),
<a name="line904"></a>  factory: goog.ui.editor.DefaultToolbar.fontFaceFactory_,
<a name="line905"></a>  queryable: true
<a name="line906"></a>}, {
<a name="line907"></a>  command: goog.editor.Command.FONT_SIZE,
<a name="line908"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_FONT_SIZE_TITLE,
<a name="line909"></a>  classes: goog.getCssName(&#39;tr-fontSize&#39;),
<a name="line910"></a>  factory: goog.ui.editor.DefaultToolbar.fontSizeFactory_,
<a name="line911"></a>  queryable: true
<a name="line912"></a>}, {
<a name="line913"></a>  command: goog.editor.Command.BOLD,
<a name="line914"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_BOLD_TITLE,
<a name="line915"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-bold&#39;),
<a name="line916"></a>  queryable: true
<a name="line917"></a>}, {
<a name="line918"></a>  command: goog.editor.Command.ITALIC,
<a name="line919"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_ITALIC_TITLE,
<a name="line920"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-italic&#39;),
<a name="line921"></a>  queryable: true
<a name="line922"></a>}, {
<a name="line923"></a>  command: goog.editor.Command.UNDERLINE,
<a name="line924"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_UNDERLINE_TITLE,
<a name="line925"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-underline&#39;),
<a name="line926"></a>  queryable: true
<a name="line927"></a>}, {
<a name="line928"></a>  command: goog.editor.Command.FONT_COLOR,
<a name="line929"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_FONT_COLOR_TITLE,
<a name="line930"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-foreColor&#39;),
<a name="line931"></a>  factory: goog.ui.editor.DefaultToolbar.fontColorFactory_,
<a name="line932"></a>  queryable: true
<a name="line933"></a>}, {
<a name="line934"></a>  command: goog.editor.Command.BACKGROUND_COLOR,
<a name="line935"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_BACKGROUND_COLOR_TITLE,
<a name="line936"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-backColor&#39;),
<a name="line937"></a>  factory: goog.ui.editor.DefaultToolbar.backgroundColorFactory_,
<a name="line938"></a>  queryable: true
<a name="line939"></a>}, {
<a name="line940"></a>  command: goog.editor.Command.LINK,
<a name="line941"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_LINK_TITLE,
<a name="line942"></a>  caption: goog.ui.editor.messages.MSG_LINK_CAPTION,
<a name="line943"></a>  classes: goog.getCssName(&#39;tr-link&#39;),
<a name="line944"></a>  queryable: true
<a name="line945"></a>}, {
<a name="line946"></a>  command: goog.editor.Command.ORDERED_LIST,
<a name="line947"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_ORDERED_LIST_TITLE,
<a name="line948"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line949"></a>      goog.getCssName(&#39;tr-insertOrderedList&#39;),
<a name="line950"></a>  queryable: true
<a name="line951"></a>}, {
<a name="line952"></a>  command: goog.editor.Command.UNORDERED_LIST,
<a name="line953"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_UNORDERED_LIST_TITLE,
<a name="line954"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line955"></a>      goog.getCssName(&#39;tr-insertUnorderedList&#39;),
<a name="line956"></a>  queryable: true
<a name="line957"></a>}, {
<a name="line958"></a>  command: goog.editor.Command.OUTDENT,
<a name="line959"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_OUTDENT_TITLE,
<a name="line960"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-outdent&#39;),
<a name="line961"></a>  factory: goog.ui.editor.ToolbarFactory.makeButton
<a name="line962"></a>}, {
<a name="line963"></a>  command: goog.editor.Command.INDENT,
<a name="line964"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_INDENT_TITLE,
<a name="line965"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-indent&#39;),
<a name="line966"></a>  factory: goog.ui.editor.ToolbarFactory.makeButton
<a name="line967"></a>}, {
<a name="line968"></a>  command: goog.editor.Command.JUSTIFY_LEFT,
<a name="line969"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_ALIGN_LEFT_TITLE,
<a name="line970"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line971"></a>      goog.getCssName(&#39;tr-justifyLeft&#39;),
<a name="line972"></a>  queryable: true
<a name="line973"></a>}, {
<a name="line974"></a>  command: goog.editor.Command.JUSTIFY_CENTER,
<a name="line975"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_ALIGN_CENTER_TITLE,
<a name="line976"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line977"></a>      goog.getCssName(&#39;tr-justifyCenter&#39;),
<a name="line978"></a>  queryable: true
<a name="line979"></a>}, {
<a name="line980"></a>  command: goog.editor.Command.JUSTIFY_RIGHT,
<a name="line981"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_ALIGN_RIGHT_TITLE,
<a name="line982"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line983"></a>      goog.getCssName(&#39;tr-justifyRight&#39;),
<a name="line984"></a>  queryable: true
<a name="line985"></a>}, {
<a name="line986"></a>  command: goog.editor.Command.JUSTIFY_FULL,
<a name="line987"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_JUSTIFY_TITLE,
<a name="line988"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line989"></a>      goog.getCssName(&#39;tr-justifyFull&#39;),
<a name="line990"></a>  queryable: true
<a name="line991"></a>}, {
<a name="line992"></a>  command: goog.editor.Command.REMOVE_FORMAT,
<a name="line993"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_REMOVE_FORMAT_TITLE,
<a name="line994"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line995"></a>      goog.getCssName(&#39;tr-removeFormat&#39;),
<a name="line996"></a>  factory: goog.ui.editor.ToolbarFactory.makeButton
<a name="line997"></a>}, {
<a name="line998"></a>  command: goog.editor.Command.IMAGE,
<a name="line999"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_IMAGE_TITLE,
<a name="line1000"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-image&#39;),
<a name="line1001"></a>  factory: goog.ui.editor.ToolbarFactory.makeButton
<a name="line1002"></a>}, {
<a name="line1003"></a>  command: goog.editor.Command.STRIKE_THROUGH,
<a name="line1004"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_STRIKE_THROUGH_TITLE,
<a name="line1005"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line1006"></a>      goog.getCssName(&#39;tr-strikeThrough&#39;),
<a name="line1007"></a>  queryable: true
<a name="line1008"></a>}, {
<a name="line1009"></a>  command: goog.editor.Command.SUBSCRIPT,
<a name="line1010"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_SUBSCRIPT,
<a name="line1011"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-subscript&#39;),
<a name="line1012"></a>  queryable: true
<a name="line1013"></a>} , {
<a name="line1014"></a>  command: goog.editor.Command.SUPERSCRIPT,
<a name="line1015"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_SUPERSCRIPT,
<a name="line1016"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line1017"></a>       goog.getCssName(&#39;tr-superscript&#39;),
<a name="line1018"></a>  queryable: true
<a name="line1019"></a>}, {
<a name="line1020"></a>  command: goog.editor.Command.DIR_LTR,
<a name="line1021"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_DIR_LTR_TITLE,
<a name="line1022"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-ltr&#39;),
<a name="line1023"></a>  queryable: true
<a name="line1024"></a>}, {
<a name="line1025"></a>  command: goog.editor.Command.DIR_RTL,
<a name="line1026"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_DIR_RTL_TITLE,
<a name="line1027"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; + goog.getCssName(&#39;tr-rtl&#39;),
<a name="line1028"></a>  factory: goog.ui.editor.DefaultToolbar.rtlButtonFactory_,
<a name="line1029"></a>  queryable: true
<a name="line1030"></a>}, {
<a name="line1031"></a>  command: goog.editor.Command.BLOCKQUOTE,
<a name="line1032"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_BLOCKQUOTE_TITLE,
<a name="line1033"></a>  classes: goog.getCssName(&#39;tr-icon&#39;) + &#39; &#39; +
<a name="line1034"></a>      goog.getCssName(&#39;tr-BLOCKQUOTE&#39;),
<a name="line1035"></a>  queryable: true
<a name="line1036"></a>}, {
<a name="line1037"></a>  command: goog.editor.Command.FORMAT_BLOCK,
<a name="line1038"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_FORMAT_BLOCK_TITLE,
<a name="line1039"></a>  caption: goog.ui.editor.DefaultToolbar.MSG_FORMAT_BLOCK_CAPTION,
<a name="line1040"></a>  classes: goog.getCssName(&#39;tr-formatBlock&#39;),
<a name="line1041"></a>  factory: goog.ui.editor.DefaultToolbar.formatBlockFactory_,
<a name="line1042"></a>  queryable: true
<a name="line1043"></a>}, {
<a name="line1044"></a>  command: goog.editor.Command.EDIT_HTML,
<a name="line1045"></a>  tooltip: goog.ui.editor.DefaultToolbar.MSG_EDIT_HTML_TITLE,
<a name="line1046"></a>  caption: goog.ui.editor.DefaultToolbar.MSG_EDIT_HTML_CAPTION,
<a name="line1047"></a>  classes: goog.getCssName(&#39;tr-editHtml&#39;),
<a name="line1048"></a>  factory: goog.ui.editor.ToolbarFactory.makeButton
<a name="line1049"></a>}];
<a name="line1050"></a>
<a name="line1051"></a>
<a name="line1052"></a>(function() {
<a name="line1053"></a>// Create the goog.ui.editor.DefaultToolbar.buttons_ map from
<a name="line1054"></a>// goog.ui.editor.DefaultToolbar.BUTTONS_.
<a name="line1055"></a>for (var i = 0, button;
<a name="line1056"></a>    button = goog.ui.editor.DefaultToolbar.BUTTONS_[i]; i++) {
<a name="line1057"></a>  goog.ui.editor.DefaultToolbar.buttons_[button.command] = button;
<a name="line1058"></a>}
<a name="line1059"></a>
<a name="line1060"></a>// goog.ui.editor.DefaultToolbar.BUTTONS_ is no longer needed
<a name="line1061"></a>// once the map is ready.
<a name="line1062"></a>delete goog.ui.editor.DefaultToolbar.BUTTONS_;
<a name="line1063"></a>
<a name="line1064"></a>})();
</pre>


</body>
</html>
